.class public Lcom/philzhu/www/framework/impl/AccelerometerHandler;
.super Ljava/lang/Object;
.source "AccelerometerHandler.java"

# interfaces
.implements Landroid/hardware/SensorEventListener;


# instance fields
.field accelX:F

.field accelY:F

.field accelZ:F


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 5
    .parameter "context"

    .prologue
    const/4 v4, 0x1

    .line 14
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 16
    const-string v2, "sensor"

    invoke-virtual {p1, v2}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v1

    .line 15
    check-cast v1, Landroid/hardware/SensorManager;

    .line 17
    .local v1, manager:Landroid/hardware/SensorManager;
    invoke-virtual {v1, v4}, Landroid/hardware/SensorManager;->getSensorList(I)Ljava/util/List;

    move-result-object v2

    invoke-interface {v2}, Ljava/util/List;->size()I

    move-result v2

    if-eqz v2, :cond_0

    .line 18
    invoke-virtual {v1, v4}, Landroid/hardware/SensorManager;->getSensorList(I)Ljava/util/List;

    move-result-object v2

    .line 19
    const/4 v3, 0x0

    invoke-interface {v2, v3}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/hardware/Sensor;

    .line 20
    .local v0, accelerometer:Landroid/hardware/Sensor;
    invoke-virtual {v1, p0, v0, v4}, Landroid/hardware/SensorManager;->registerListener(Landroid/hardware/SensorEventListener;Landroid/hardware/Sensor;I)Z

    .line 23
    .end local v0           #accelerometer:Landroid/hardware/Sensor;
    :cond_0
    return-void
.end method


# virtual methods
.method public getAccelX()F
    .locals 1

    .prologue
    .line 38
    iget v0, p0, Lcom/philzhu/www/framework/impl/AccelerometerHandler;->accelX:F

    return v0
.end method

.method public getAccelY()F
    .locals 1

    .prologue
    .line 42
    iget v0, p0, Lcom/philzhu/www/framework/impl/AccelerometerHandler;->accelY:F

    return v0
.end method

.method public getAccelZ()F
    .locals 1

    .prologue
    .line 46
    iget v0, p0, Lcom/philzhu/www/framework/impl/AccelerometerHandler;->accelZ:F

    return v0
.end method

.method public onAccuracyChanged(Landroid/hardware/Sensor;I)V
    .locals 0
    .parameter "sensor"
    .parameter "accuracy"

    .prologue
    .line 28
    return-void
.end method

.method public onSensorChanged(Landroid/hardware/SensorEvent;)V
    .locals 2
    .parameter "event"

    .prologue
    .line 32
    iget-object v0, p1, Landroid/hardware/SensorEvent;->values:[F

    const/4 v1, 0x0

    aget v0, v0, v1

    iput v0, p0, Lcom/philzhu/www/framework/impl/AccelerometerHandler;->accelX:F

    .line 33
    iget-object v0, p1, Landroid/hardware/SensorEvent;->values:[F

    const/4 v1, 0x1

    aget v0, v0, v1

    iput v0, p0, Lcom/philzhu/www/framework/impl/AccelerometerHandler;->accelY:F

    .line 34
    iget-object v0, p1, Landroid/hardware/SensorEvent;->values:[F

    const/4 v1, 0x2

    aget v0, v0, v1

    iput v0, p0, Lcom/philzhu/www/framework/impl/AccelerometerHandler;->accelZ:F

    .line 35
    return-void
.end method
